Skip to main content

All Questions

Tagged with
1vote
1answer
148views

Function, which replaces consecutive white-space with a single white-space

Task-description: Implement a function, which returns a string with all consecutive whites-spaces replaced as a single-space. Example: "a[space][space][space]b[space][space][space]c" shall ...
michael.zech's user avatar
4votes
1answer
135views

Is Palindrom-function in Swift

Task is simply to write the classic isPalindrom-function. Here's my implementation: ...
michael.zech's user avatar
6votes
1answer
508views

Swift-function, which checks if all letters in a string are unique

The task is writing a function, which checks if a string contains only unique characters. Means: is each character is included only one time. Here's the solution, I have developed: ...
michael.zech's user avatar
2votes
2answers
328views

Swift-function, which counts all occurrences of a character within a string

I wrote this function, which (shall) count all occurrences of a specified character within a given string. ...
michael.zech's user avatar
1vote
3answers
2kviews

Convert first letter of every word to uppercase

I am learning swift and I came across this problem. Converting each start letter to capitalized form if it's lowercase. ...
BoredToDeath's user avatar
2votes
1answer
258views

Trie implementation for strings in Swift

A trie for handling strings for an autocomplete dictionary. This passes my fairly casual tests, though it's always possible that there are broken edge cases, but I'm mainly concerned about design and ...
Paul Gowder's user avatar
3votes
1answer
115views

Determine fragment identifier from HTML page in Swift

For an iOS app which helps me rolling back vandalism on Stack Exchange, I have a piece of Swift code which downloads a revision page (example) and tries to find the 'spacer' fragment just above a ...
Glorfindel's user avatar
2votes
1answer
2kviews

Find indices of white space characters in a string

This function returns the indices of all white spaces as an array of Integer. It works fine with a small string: ...
mazen's user avatar
3votes
1answer
192views

Splitting a long string based on its graphical presentation

I got a long string, let's call it Story. I fetch this story from a database so I don't know how long it is. I want to display this story in a view, but what if ...
mazen's user avatar
1vote
2answers
205views

Converting a String to USD

I'm working on a clientside iOS app for my school that involves students purchasing things, and I wrote a String extension for formatting a ...
atirit's user avatar
2votes
1answer
374views

Toggle case of a string in Swift

What is benefit of using uppercased() / lowercased() over the following approach ? (Other than making it more readable) Any ...
kanadenipun's user avatar
4votes
1answer
846views

Checking whether strings are permutations of each other in Swift

I'm solving this problem on Hacker Earth, just for practice. The exercise is to determine whether two given equal-length strings are permutations of each other. Except for this one test case, which ...
kanadenipun's user avatar
2votes
1answer
2kviews

Filtering input characters for a numeric text field using logical operators

I did my code for "Bronze Challenge: Disallow Alphabetic characters" exercise in "iOS programming" book by Big Nerd Ranch (p.85). When I did the exercise I also changed code of func textField which ...
Slava's user avatar
0votes
1answer
835views

Find common directory path

I answered the problem of Find common directory path from Rosetta Code. The problem consists of passing '/home/user1/tmp/coverage/test', ...
lf_araujo's user avatar
3votes
2answers
4kviews

Comparing strings, ignoring case, punctuation, and whitespace

I have built a search function that will compare strings regardless of punctuation and whitespace. It is case insensitive. Here is my current function: ...
evenwerk's user avatar

153050per page
close